<template>
	<view class="work-container">
		<!-- 宫格组件 -->
		<uni-section title="AI功能服务" type="line" title-font-size="50rpx"></uni-section>
		<view class="grid-body">
			<uni-grid :column="4" :showBorder="false" @change="changeGrid">
				<uni-grid-item v-for="(item, index) in gridList" :key="index" :index="index">
					<view class="grid-item-box">
						<uni-icons :type="item.icon" size="30"></uni-icons>
						<text class="text">{{item.text}}</text>
					</view>
				</uni-grid-item>
			</uni-grid>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				gridList: [{
						icon: 'person-filled',
						text: '文本生成'
					},
					{
						icon: 'staff-filled',
						text: '语音识别/合成'
					},
					{
						icon: 'color',
						text: '图像生成'
					},
					{
						icon: 'settings-filled',
						text: '视频生成'
					},
					{
						icon: 'chatboxes',
						text: 'PPT生成'
					},
					{
						icon: 'map',
						text: '思维导图'
					},
					{
						icon: 'compose',
						text: '写作辅助'
					},
					{
						icon: 'sound',
						text: '音乐生成'
					}
				]
			}
		},
		methods: {
			changeGrid(e) {
				let {
					index
				} = e.detail;
				let url = '';
				switch (index) {
					case 0:
						url = '/pages/work/text-generate/index';
						break;
					case 1:
						url = '/pages/work/voice/index';
						break;
					case 2:
						url = '/pages/work/image-generate/index';
						break;
					case 3:
						url = '/pages/work/video-generate/index';
						break;
					case 4:
						url = '/pages/work/ppt-generate/index';
						break;
					case 5:
						url = '/pages/work/mindmap-generate/index';
						break;
					case 6:
						url = '/pages/work/writing-generate/index';
						break;
					case 7:
						url = '/pages/work/music-generate/index';
						break;
					default:
						this.$modal.showToast('模块建设中~');
						return;
				}
				uni.navigateTo({
					url: url
				});
			}
		}
	}
</script>

<style lang="scss">
	/* #ifndef APP-NVUE */

	.work-container {
		padding-top: 100rpx;
	}

	uni-section {
		font-size: 50rpx;
		size: 50rpx;
	}

	page {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		background-color: #fff;
		min-height: 100%;
		height: auto;
	}

	view {
		font-size: 14px;
		line-height: inherit;
	}

	/* #endif */

	.text {
		text-align: center;
		font-size: 26rpx;
		margin-top: 10rpx;
	}

	.grid-item-box {
		flex: 1;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
	}

	.uni-margin-wrap {
		width: 690rpx;
		width: 100%;
		;
	}

	.swiper {
		height: 300rpx;
	}

	.swiper-box {
		height: 150px;
	}

	.swiper-item {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		justify-content: center;
		align-items: center;
		color: #fff;
		height: 300rpx;
		line-height: 300rpx;
	}

	@media screen and (min-width: 500px) {
		.uni-swiper-dot-box {
			width: 400px;
			/* #ifndef APP-NVUE */
			margin: 0 auto;
			/* #endif */
			margin-top: 8px;
		}

		.image {
			width: 100%;
		}
	}
</style>